xenstat: Adding to scan blktap information.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Jun 2007 10:13:41 +0000 (11:13 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 7 Jun 2007 10:13:41 +0000 (11:13 +0100)
Signed-off-by: Satoshi UCHIDA <s-uchida@ap.jp.nec.com>
tools/xenstat/libxenstat/src/xenstat.c
tools/xenstat/libxenstat/src/xenstat.h
tools/xenstat/libxenstat/src/xenstat_linux.c
tools/xenstat/libxenstat/src/xenstat_priv.h

index 7678aca46ef3370787424cc32530d5b64e61b984..93d228c2f68b46fac0940db35faf9360b0c54064 100644 (file)
@@ -625,6 +625,12 @@ static void xenstat_free_vbds(xenstat_node * node)
                free(node->domains[i].vbds);
 }
 
+/* Get the back driver type  for Virtual Block Device */
+unsigned int xenstat_vbd_type(xenstat_vbd * vbd)
+{
+       return vbd->back_type;
+}
+
 /* Get the major number of VBD device */
 unsigned int xenstat_vbd_dev(xenstat_vbd * vbd)
 {
index 345a1eda1485a38371cf3f1487fb42fad9a9274f..e7bf3e130c8d856cd630f6f06a2968cfdefdb389 100644 (file)
@@ -172,6 +172,10 @@ unsigned long long xenstat_network_tdrop(xenstat_network * network);
 /*
  * VBD functions - extract information from a xen_vbd
  */
+
+/* Get the back driver type  for Virtual Block Device */
+unsigned int xenstat_vbd_type(xenstat_vbd * vbd);
+
 /* Get the device number for Virtual Block Device */
 unsigned int xenstat_vbd_dev(xenstat_vbd * vbd);
 
index db45ad576199aa21e4ecd520521d8fbf6b2dea5a..d6e2cf3fe03f4fa1ce1e2266db6dc38c38278645 100644 (file)
@@ -204,17 +204,23 @@ int xenstat_collect_vbds(xenstat_node * node)
                int ret;
                char buf[256];
 
+               ret = sscanf(dp->d_name, "%3s-%u-%u", buf, &domid, &vbd.dev);
+               if (ret != 3)
+                       continue;
 
-               ret = sscanf(dp->d_name, "vbd-%u-%u", &domid, &vbd.dev);
-               if (ret != 2)
+               if (strcmp(buf,"vbd") == 0)
+                       vbd.back_type = 1;
+               else if (strcmp(buf,"tap") == 0)
+                       vbd.back_type = 2;
+               else
                        continue;
 
                domain = xenstat_node_domain(node, domid);
                if (domain == NULL) {
                        fprintf(stderr,
-                               "Found interface vbd-%u-%u but domain %u"
+                               "Found interface %s-%u-%u but domain %u"
                                " does not exist.\n",
-                               domid, vbd.dev, domid);
+                               buf, domid, vbd.dev, domid);
                        continue;
                }
 
index 719edad8ff687b8bebaee77ba39cadf91e8f9437..46607a61f2ecd0612b92c4618b4711555257769d 100644 (file)
@@ -87,10 +87,11 @@ struct xenstat_network {
 };
 
 struct xenstat_vbd {
-       unsigned int dev;
-       unsigned long long oo_reqs;
-       unsigned long long rd_reqs;
-       unsigned long long wr_reqs;
+       unsigned int back_type;
+       unsigned int dev;
+       unsigned long long oo_reqs;
+       unsigned long long rd_reqs;
+       unsigned long long wr_reqs;
 };
 
 extern int xenstat_collect_networks(xenstat_node * node);